<template>
  <a-drawer
    width="60%"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{ height: 'calc(100vh - 100px)', overflow: 'auto' }"
    @close="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32" style="width: 90%; left: 10%">
          <a-col :span="24" style="margin-left: -100px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >基本信息</span
              >
            </div>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="产品所属机构" prop="orgType">
              <a-select
                placeholder="请选择产品所属机构"
                v-model="form.orgType"
                :getPopupContainer="
                  (triggerNode) => {
                    return triggerNode.parentNode || document.body;
                  }
                "
                style="width: 100%"
                allow-clear
              >
                <a-select-option
                  v-for="(d, index) in orgTypeOptions"
                  :key="index"
                  :value="d.dictValue"
                  >{{ d.dictLabel }}</a-select-option
                >
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="产品名称" prop="productName">
              <a-input
                v-model="form.productName"
                placeholder="请输入产品名称"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="抵押机构" prop="diyajigou">
              <a-input v-model="form.diyajigou" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="利息" prop="lv">
              <a-input v-model="form.lv" />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="评估价格" prop="pgPrice">
              <a-input v-model="form.pgPrice" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="融资层数" prop="rongziBili">
              <a-textarea
                :rows="2"
                v-model="form.rongziBili"
                placeholder="请输入融资层数"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="车龄" prop="carOwnerAge">
              <a-textarea :rows="2" v-model="form.carOwnerAge" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="车主年龄" prop="ownerage">
              <a-textarea :rows="2" v-model="form.ownerage" />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="公里数" prop="kmCounts">
              <a-textarea :rows="2" v-model="form.kmCounts" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="电话核实" prop="phoneCheck">
              <a-textarea
                :rows="2"
                v-model="form.phoneCheck"
                placeholder="请输入电话核实"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="抵押状态" prop="diyaStatus">
              <a-textarea :rows="4" v-model="form.diyaStatus" />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="号码实名" prop="phoneNameChekc">
              <a-textarea
                :rows="4"
                v-model="form.phoneNameChekc"
                placeholder="请输入号码实名"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="过户条件" prop="chengeOther">
              <a-textarea
                v-model="form.chengeOther"
                placeholder="请输入过户条件"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="重点材料" prop="zhongdiancailiao">
              <a-textarea
                v-model="form.zhongdiancailiao"
                placeholder="请输入重点材料"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="补领绿本" prop="carDaben">
              <a-textarea
                v-model="form.carDaben"
                placeholder="请输入补领绿本"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="准入车牌" prop="carNoCheck">
              <a-textarea
                v-model="form.carNoCheck"
                placeholder="请输入准入车牌"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="6">
            <a-form-model-item label="公户车" prop="companyCar">
              <a-textarea
                v-model="form.companyCar"
                placeholder="请输入公户车"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="征信情况" prop="zhengxin">
              <a-textarea
                v-model="form.zhengxin"
                placeholder="请输入征信情况"
                :rows="4"
              />
            </a-form-model-item>
          </a-col>

          <a-col :span="24" style="margin-left: -100px; margin-bottom: 15px">
            <div style="display: flex; flex-direction: row">
              <span
                style="
                  width: 5px;
                  height: 22px;
                  background-color: coral;
                  display: block;
                "
              ></span>
              <span
                style="
                  margin-left: 5px;
                  height: 22px;
                  line-height: 22px;
                  font-size: 16px;
                  font-weight: 600;
                "
                >资料信息</span
              >
            </div>
          </a-col>

          <!-- 动态渲染多个列 -->
          <a-col
            v-for="(field, index) in productFilesOptions"
            :key="index"
            :span="4"
          >
            <a-form-model-item :label="field.dictLabel">
              <a-radio-group
                v-model="productFileDatas[field.dictLabel]"
                button-style="solid"
                @change="
                  handleProductFilesChange(
                    field.dictLabel,
                    productFileDatas[field.dictLabel]
                  )
                "
              >
                <a-radio-button value="是"> 是 </a-radio-button>
                <a-radio-button value="否"> 否 </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button @click="cancel"> 取消 </a-button>
          <a-button type="primary" @click="submitForm"> 保存 </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import BizProductInfoEditForm from "./BizProductInfoForm";
export default {
  ...BizProductInfoEditForm,
};
</script>
